Ext.define('Emp.view.role.List', {
	extend: 'Emp.view.BaseList',
	alias: 'widget.rolelist',
	
	requires: [
		'Emp.store.Role',
		'Emp.ux.toolbar.GridToolbar',
		'Emp.ux.toolbar.Paging'
	],
	
	initComponent: function() {		
		var gridStore = Ext.create('Emp.store.Role', {
			listeners: {
				scope: this,
				'beforeload': this.doBeforeLoad,
        		'load': this.doLoad
			}
		});
		this.grid = Ext.create('Ext.grid.Panel', {
			region: 'center',
			store: gridStore,
			selModel: Ext.create('Ext.selection.CheckboxModel'),
			columns: [{
					xtype: 'rownumberer',
					width: 40
				}, {
					header: 'id',
					dataIndex: 'id',
					hidden: true,
					hideable: false
				}, {
					header: '英文名',
					dataIndex: 'enName',
					width: 200
				}, {
					header: '中文名',
					dataIndex: 'cnName',
					width: 200
				}, {
					header: '状态',
					dataIndex: 'status',
					renderer: function(value) {
						return value === 'enable' ? '启用' : '停用';
					}
				}, {
					header: '排序',
					dataIndex: 'sort'
			}],
			dockedItems:[{
					xtype: 'gridtoolbar',
					dock: 'top',
					items: ['-', {
							itemId: 'userConfig',
							text: '组用户',
							iconCls: 'config'
						}, '-', {
							itemId: 'permissionConfig',
							text: '组权限',
							iconCls: 'config'
					}]
				}, {
					xtype: 'paging',
					store: gridStore,
					dock: 'bottom',
        			displayInfo: true
			}]
		});
		Ext.apply(this, {
			layout: 'fit',
			items: [this.grid]
		});
		this.callParent();
	}
});